package net.cyndeline.components.item

import net.cyndeline.entitySystem.Component

trait DurabilityComponent extends Component {
  
  /** Current durability. */
  def durability: Int
  
  /** Sets a new durability. */
  def durability_=(newDurability: Int)
  
  /** Maximum durability. */
  def max: Int
  
  /** Sets a new maximum durability. */
  def max_=(newMax: Int)
}

class Durability extends DurabilityComponent {
  override var durability = 0
  override var max = 0
  
  override def copy = {
    val copy = new Durability()
    copy.durability = durability
    copy.max = max
    copy
  }
}